<template>
  <div class="c-bg-white c-ph40">
    <div class="c-fs32 c-fc-sxblack c-textAlign-c c-pt180 c-lh60">{{topicName}}</div>
    <div class="c-fs22 c-fc-gray c-textAlign-c c-mt40">{{questionNum}}题</div>
    <div class="c-w60 c-m-0auto c-fs28 c-fc-white c-hh80 c-textAlign-c c-flex-row c-flex-center theme-bg c-mt120 c-br10 c-mb40" @click="startTest">{{isTest == 1 ? '查看结果' : '随机练习'}}</div>
    <div class="c-w60 c-m-0auto c-fs28 c-fc-white c-hh80 c-textAlign-c c-flex-row c-flex-center theme-bg c-br10" @click="watchWrong">查看题目</div>
  </div>
</template>

<script>
import { utilJs } from "@/utils/common.js"
export default {
  name: "ExaminationWrongEntry",
  components: {

  },
  props: [],
  data() {
    return {
      theme: localStorage.getItem("colorName") ? localStorage.getItem("colorName") : 'mb5_default',
      topicName: '',
      topicId: '',
      continueNum: '',
      examMainId: '',
      isTest: '',
      questionNum: '',
      paperId:''
    };
  },
  created() {
    utilJs.appShare(this);
  },
  activated() {
    setDocumentTitle("开始测试");// eslint-disable-line
    this.$store.commit('updateLoadingStatus', {
      isLoading: false
    });
    this.topicName = this.$route.query.topicName;
    this.topicId = this.$route.query.topicId;
    this.continueNum = this.$route.query.continueNum;
    this.examMainId = this.$route.query.examMainId;
    this.isTest = this.$route.query.isTest;
    this.questionNum = this.$route.query.questionNum;
    this.paperId = this.$route.query.paperId;
    this.wechatShare();
  },
  deactivated() {
  },
  mounted() { },
  methods: {
    startTest() {
      let $this = this;
      // 传参数 ckFrom： 1=测评错题集， 2=考试错题集
      //       prodId: 测评Id OR 试卷Id
      if (this.isTest == 1) {
        $this.$routerGo($this, "replace", {
          path: "/member/myWrongTopic/examWrongTopic/examinationWrongResult",
          query: { examMainId: $this.examMainId, topicId: $this.topicId, paperId:$this.paperId }
        });
      } else {
      // if (this.isTest == 0) {
        utilJs.postMethod(global.apiurl + "exam/joinCollectionExam", {
          ckFrom: this.topicId ? 1 : 2,
          prodId: this.topicId ? this.topicId : this.paperId
        },
        res => {
          $this.$routerGo($this, "replace", {
            path: "/member/myWrongTopic/examWrongTopic/examinationWrongAnswer",
            query: { questionNum: $this.questionNum, examMainId: res.examMainId, goOnNum: 1, topicId: $this.topicId, paperId:$this.paperId }
          });
        })
      }
      //  else if (this.isTest == 2) {
      //   $this.$routerGo($this, "replace", {
      //     path: "/member/myWrongTopic/examWrongTopic/examinationWrongAnswer",
      //     query: { questionNum: $this.questionNum, examMainId: $this.examMainId, goOnNum: this.continueNum, topicId: $this.topicId, paperId:$this.paperId }
      //   });
      // }
    },
    watchWrong() {
      this.$routerGo(this, "replace", {
        path: "/member/myWrongTopic/examWrongTopic/examinationWrongAnswerAnalyze",
        query: { topicId: this.topicId, examMainId: this.examMainId, paperId:this.paperId, allcheck:true}
      });
    },
    //分享
    wechatShare: function () {
      utilJs.wechatConfig("", "", "", "", function () { });
    },
    //手机端分享
    appShare: function () {
      utilJs.appShareTrue("", "", "", "");
    }
  }
};
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->

<style scoped>
</style>
